import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        component: HomeView,
        children: [
            {
                path: '/sys-admin/index',
                component: () => import('../views/sys-admin/AdminIndexView')
            },
            {
                path: '/sys-admin/banner/banner-list',
                component: () => import('../views/sys-admin/banner/BannerListView')
            },
            {
                path: '/sys-admin/banner/banner-add',
                component: () => import('../views/sys-admin/banner/BannerAddView')
            },
            {
                path: '/sys-admin/book/book-list',
                component: () => import('../views/sys-admin/book/BookListView')
            },
            {
                path: '/sys-admin/book/book-add',
                component: () => import('../views/sys-admin/book/BookAddView')
            },
            {
                path: '/sys-admin/product/product-list',
                component: () => import('../views/sys-admin/product/ProductListView')
            },
            {
                path: '/sys-admin/product/product-add',
                component: () => import('../views/sys-admin/product/ProductAddView')
            },
            {
                path: '/sys-admin/user/user-list',
                component: () => import('../views/sys-admin/user/UserListView')
            },
            {
                path: '/sys-admin/user/user-add',
                component: () => import('../views/sys-admin/user/UserAddView')
            },
        ]
    },
    {
        path: '/login',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/LoginView.vue')
    },
    {
        path: '/web',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-web/WebIndexView'),
        children: [
            {
                path: '/sys-web/firstpage/first',
                component: () => import('../views/sys-web/firstpage/FirstPageView')
            }
        ]
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
